<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>ArrayTest2</title>
    <style>
      .a {
        width: 0;
        height: 0;
        border-width: 100px;
        border-style: solid;
        border-color: transparent #0099cc transparent transparent;
        transform: rotate(90deg);
        /*顺时针旋转90°* border-color 上 右 下 左 */
      }
    </style>
  </head>

  <body>
    <div class="a"></div>
    <script>
      const months = ['Jan', 'March', 'April', 'June']
      months.splice(1, 0, 'Feb')
      // inserts at index 1
      console.log(months)
      // expected output: Array ["Jan", "Feb", "March", "April", "June"]

      months.splice(4, 1, 'May')
      // replaces 1 element at index 4
      console.log(months)
      // expected output: Array ["Jan", "Feb", "March", "April", "May"]
      var myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
      var removed = myFish.splice(2, 0, 'drum')

      // 运算后的 myFish: ["angel", "clown", "drum", "mandarin", "sturgeon"]
      // 被删除的元素: [], 没有元素被删除

      // 从第 3 位开始删除 1 个元素
      var myFish = ['angel', 'clown', 'drum', 'mandarin', 'sturgeon']
      var removed = myFish.splice(3, 1)

      // 运算后的 myFish: ["angel", "clown", "drum", "sturgeon"]
      // 被删除的元素: ["mandarin"]

      // 从第 2 位开始删除 1 个元素，插入“trumpet”
      var myFish = ['angel', 'clown', 'drum', 'sturgeon']
      var removed = myFish.splice(2, 1, 'trumpet')

      // 运算后的 myFish: ["angel", "clown", "trumpet", "sturgeon"]
      // 被删除的元素: ["drum"]

      var triangle = {
        a: 1,
        b: 2,
        c: 3,
      }

      function ColoredTriangle() {
        this.color = 'red'
      }

      ColoredTriangle.prototype = triangle

      var obj = new ColoredTriangle()

      for (var prop in obj) {
        console.log(prop)
        if (obj.hasOwnProperty(prop)) {
          console.log(`obj.${prop} = ${obj[prop]}`)
        }
      }

      // Output:
      // "obj.color = red"
    </script>
  </body>
</html>
